#ifndef _BIGINT_H
#define _BIGINT_H

#include <stdio.h>

#define max256 16;		//	128 digits base 2 = 16 digits base 256
#define maxStr 41;		//	39 digits base 10 + signe '-' + Null
#define maxStrBin 129;	//	128 digit base 2 + null

typedef struct{
	unsigned char digit[ max256 ];
}BigInt; 

int checkStr( char* );	//	return 0 if the string is > maxStr digit or contain a charater different form decimal digits; else return 1
void reform( char*/*num in String*/);	//	fill the string with '0'. Ex: '1234' = '0000...1234'
void convertStrToBigInt( BigInt&, char* /*Decimal number in string*/ );
void inputBigInt( BigInt& );			//	input BigInt in decimal
void outputBigInt( BigInt& );			//	output BigInt in decinmal
void outputBigIntBin( BigInt& );		//	output BigInt in binary

BigInt complement( BigInt& x );			//	return -x
BigInt minimulti( BigInt&, unsigned char& /* digit value*/, int&/* digit index (0 -> 15)*/ );
//	return produit of 1 BigInt and 1 digit (1 unsignedchar, 1byte) of the other BigInt. The Index of this  digit helps keeping the numbers neatly in collumn
int compare( BigInt& x, BigInt& y );	//	return 1 if x > y;	return 0 if x = y;	return -1 if x < y

BigInt plus( BigInt&, BigInt& );		//	return sum
BigInt minus( BigInt& x, BigInt y );	//	return x - y
BigInt multi( BigInt&, BigInt& );		//	return produit
int div( BigInt &quotient, BigInt &x, BigInt &y );		//	return 0 if y = 0; else return 1, quotient = x/y
int mod( BigInt &x, BigInt &y );	//	returm x mod y

BigInt and( BigInt&, BigInt& );			//	'&' (and) operator
BigInt or( BigInt&, BigInt& );			//	'|' (or) operator
BigInt xor( BigInt&, BigInt& );			//	'^' (ex-or) operator
void not( BigInt& );					//	'!' (not) operator
void sfl( BigInt&, int n );				//	'>> n' (shift right n bits) operator
void sfr( BigInt&, int n );				//	'<< n' (shift left n bits) operator

#endif